@abstract extends Node2D

var room_list = {}
var player_list = {}

func _ready() -> void:
	_init_signal()

@abstract func _init_signal() -> void

func _on_child_entered_tree_event(node : Node2D) -> void :
	var childs = get_children()
	for child in childs :
		if child == node or not is_in_group("player"): continue
		child._set_synchronizer(node.name.to_int(),true)

func _on_child_exiting_tree_event(node : Node2D) -> void :
	for child in get_children() :
		if not is_in_group("player"): continue
		child._set_synchronizer(node.name.to_int(),false)

func _player_change_room(target_player : Node2D, target_room : Node2D) -> void :
	print("玩家：",target_player.name,"切换房间")
	var ori_room = target_player.get_parent()
	ori_room.remove_child(target_player)
	target_room.add_child(target_player)
